from fogmini import global_objects

class Case(object):
    def __init__(self, id, name):
        self.id = id
        self.name = name

    @staticmethod
    def search(query):
        cases = global_objects.fb.search(q=query, cols="ixBug,sTitle")

        case_objs = []
        for case in cases.findAll("case"):
            case_objs.append(Case(case.find("ixbug").contents[0], case.find("stitle").contents[0]))

        return case_objs
